aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/(app)/[username]/invoice/[hash]/+layout.server.js')
-rw-r--r--src/routes/(app)/[username]/invoice/[hash]/+layout.server.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js b/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js
index 7cf87e14..04d413bb 100644
--- a/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js
+++ b/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js
@@ -12,10 +12,12 @@ export async function load({ depends, params, url, parent }) {
if (user && invoice.uid !== user.id && !url.pathname.includes('tip'))
throw redirect(307, `/send/invoice/${hash}`);
- let { amount, received } = invoice;
+ let { amount, pending, received } = invoice;
amount = parseInt(amount);
- let paid = (!amount && received) || (amount > 0 && received >= amount);
+ console.log("PENDING", pending)
+
+ let paid = (!amount && received) || (amount > 0 && (pending >= amount || received >= amount));
if (paid && !url.pathname.endsWith('paid'))
throw redirect(307, `/${params.username}/invoice/${hash}/paid`);